interface CardType {
  id: string | number;
  name: string;
  comments: CommentType[];
  files: FileType[];
  success: boolean;
  performers: PerformerType[];
  data: string;
  tags: string[];
  subtasks?: CardType[];
  is_closed: number;
}

type PerformerType = {
  id: string | number;
  name: string;
  image: string;
};

type CommentType = {
  id: number | string;
  text: string;
};

type FileType = {
  src?: string;
  small?: string;
  medium?: string;
  large?: string;
  type?: string;
  icon?: string;
  url?: string;
};

interface TaskBoard {
  execution_time: number;
  data: TaskBoardData;
  success: string;
}
type TaskBoardData = {
  columns: Column[];
  create_at: string;
  creator_id: 2;
  description: string;
  id: number;
  name: string;
  public_key: string;
  status_id: number;
  execution_time: number;
  success: string;
};

type TaskBoardResponse = TaskBoard;

interface Column {
  id: number;
  color?: string;
  name: string;
  tasks: Task[];
}
type PostColumnResponse = {
  data: Column[];
  execution_time: number;
  success: string;
};
type PostColumnResponseError = {
  err: string;
  err_code: string;
  success: string;
};
type ColumnResponse = Column;
type ColumnsResponse = Column[];

interface PostRequest {
  success: string | false;
  execution_time: number;
}

// Project
interface ProjectListItem {
  date: string;
  description: string;
  id: string;
  name: string;
  statusName: null;
}

type ProjectList = ProjectListItem[];

//  TASK
interface Task {
  name: string;
  id: number;
  column_id: number;
  end_date: null | string | Date;
  files: TaskFile[];
  is_closed: TaskCheck;
  performers: TaskPerformer[];
  priority_id: null | number;
  parent_id: number;
  status: any;
  subtasks: Task[];
  text: string;
  type_id: number | null;
  tags: TaskTag[];
  files_gid: number | string;
  comments: TaskComment;
  subtaskOpen: boolean;
  pinned: 0 | 1;
}

interface TaskItem extends Task {
  actions: TaskItemActionsItem[];
}

interface TaskItemAction {
  userName: string;
  userImage: string;
  date: Date;
  action: string;
}

type TaskTag = {
  color: string;
  tag: string;
};

type TypeTaskComment = {
  id: number;
  text: string;
  userId: number;
  userName: string;
  userPhoto: string;
  files: TaskFile[];
  reply_to: {
    files: boolean;
    id: number;
    text: string;
  };
};

type TaskComment = {
  count: number;
  last: TypeTaskComment;
  new: number;
};

type TaskCheck = 0 | 1;
type TaskFile = {
  large: string;
  medium: string;
  small: string;
  type: string;
  icon: string;
  url: string;
  icon: string;
};
type TaskPerformer = {
  id: string | number;
  name: string;
  image: string;
};

type TaskResponse = Task;
type TasksResponse = Task[];

type PostCreateTaskParams = {
  name: string;
  auto: number;
  text: string;
  project_id: string;
  column_id: string;
};

type MoveTask = {
  task_id: number;
  project_id: string;
  column_id: number;
  parent_id: number;
  position: number;
};

// PROJECT
interface Project {
  id: string;
  name: string;
  description: string;
  public_key: string;
  create_at: string;
  status_id: number;
  creator_id: number;
  columns: Column[];
}

interface ProjectList {
  data: {
    name: string;
    description: string;
    id: string;
    date: string;
    statusName: string | null;
  }[];
  execution_time: number;
  success: string;
}

type ProjectResponse = {
  success: string | false;
  data: Project;
  execution_time: string;
};
